package com.example.zuoye.controller;

import com.example.zuoye.entity.Good;
import com.example.zuoye.resultentity.ResultDT;
import com.example.zuoye.service.SearchGoodService;
import com.example.zuoye.utils.ResultDTUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SearchGoodController {
    @Autowired
    SearchGoodService searchGoodService;

    @RequestMapping("/searchGoodByName")
    public ResultDT searchGoodByName(@RequestParam String search,
                                     @RequestParam Integer page,
                                     @RequestParam Integer size){
        List<Good> SearchGoodList = searchGoodService.getListSearchGood(search,page,size);
        return ResultDTUtils.success(SearchGoodList);
    }
}
